Only show the last button if we can jump to the end. (gtk_assistant_init):
authorMatthias Clasen <mclasen@redhat.com>
Mon, 23 Jan 2006 19:11:40 +0000 (19:11 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 23 Jan 2006 19:11:40 +0000 (19:11 +0000)
2006-01-23  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkassistant.c (compute_last_button_state): Only show the
last button if we can jump to the end.
(gtk_assistant_init): Make the spacing and button order more
HIG compliant.

ChangeLog
ChangeLog.pre-2-10
gtk/gtkassistant.c

index bceb24b4499d805cd962991a1cecebf65d764b99..f9660a2742e4f0332db183a75c91f493cb9b6974 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2006-01-23  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkassistant.c (compute_last_button_state): Only show the
+       last button if we can jump to the end. 
+       (gtk_assistant_init): Make the spacing and button order more
+       HIG compliant.
+
        Fix drawing issues in progress bars.  (#328081, Christian Persch)
        
        * gtk/gtkprogressbar.c (gtk_progress_bar_size_request): Always
index bceb24b4499d805cd962991a1cecebf65d764b99..f9660a2742e4f0332db183a75c91f493cb9b6974 100644 (file)
@@ -1,5 +1,10 @@
 2006-01-23  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkassistant.c (compute_last_button_state): Only show the
+       last button if we can jump to the end. 
+       (gtk_assistant_init): Make the spacing and button order more
+       HIG compliant.
+
        Fix drawing issues in progress bars.  (#328081, Christian Persch)
        
        * gtk/gtkprogressbar.c (gtk_progress_bar_size_request): Always
index cdabfda6c7ac48be79fefa65d08ff4f3a9f68090..18a1c69a7a692a4dbdae9599202ad85f4f1055f4 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "gtkbutton.h"
 #include "gtkhbox.h"
+#include "gtkhbbox.h"
 #include "gtkimage.h"
 #include "gtklabel.h"
 #include "gtksizegroup.h"
@@ -387,16 +388,24 @@ compute_last_button_state (GtkAssistant *assistant)
   n_pages  = gtk_assistant_get_n_pages (assistant);
   page_info = g_list_nth_data (priv->pages, page_num);
 
-  while ((page_num > 0 && page_num < n_pages) &&
+  while (page_num >= 0 && page_num < n_pages &&
         (page_info->type == GTK_ASSISTANT_PAGE_CONTENT) &&
-        (page_info->complete))
+        page_info->complete && count < n_pages)
     {
-      page_num  = (priv->forward_function) (page_num, priv->forward_function_data);
+      page_num = (priv->forward_function) (page_num, priv->forward_function_data);
       page_info = g_list_nth_data (priv->pages, page_num);
+
       count++;
+
+      g_assert (page_info);
     }
 
-  if (count > 1)
+  /* make the last button visible if we can skip multiple
+   * pages and end on a confirmation or summary page 
+   */
+  if (count > 1 && 
+      (page_info->type == GTK_ASSISTANT_PAGE_CONFIRM ||
+       page_info->type == GTK_ASSISTANT_PAGE_SUMMARY))
     gtk_widget_show (assistant->last);
   else
     gtk_widget_hide (assistant->last);
@@ -663,9 +672,10 @@ gtk_assistant_init (GtkAssistant *assistant)
   gtk_widget_set_parent (priv->sidebar_image, GTK_WIDGET (assistant));
   gtk_widget_show (priv->sidebar_image);
 
-  /* Action area */
-  priv->action_area  = gtk_hbox_new (FALSE, 12);
-  gtk_container_set_border_width (GTK_CONTAINER (priv->action_area), 6);
+  /* Action area  */
+  priv->action_area  = gtk_hbox_new (FALSE, 6);
+  gtk_container_set_border_width (GTK_CONTAINER (priv->action_area), 12);
+  
   assistant->close   = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
   assistant->apply   = gtk_button_new_from_stock (GTK_STOCK_APPLY);
   assistant->forward = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD);
@@ -683,21 +693,21 @@ gtk_assistant_init (GtkAssistant *assistant)
 
   if (!alternative_button_order (assistant))
     {
-      gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->close, FALSE, FALSE, 0);
       gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->apply, FALSE, FALSE, 0);
+      gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->last, FALSE, FALSE, 0);
       gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->forward, FALSE, FALSE, 0);
       gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->back, FALSE, FALSE, 0);
       gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->cancel, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->last, FALSE, FALSE, 0);
+      gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->close, FALSE, FALSE, 0);
     }
   else
     {
-      gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->cancel, FALSE, FALSE, 0);
       gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->close, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->apply, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->forward, FALSE, FALSE, 0);
+      gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->cancel, FALSE, FALSE, 0);
       gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->back, FALSE, FALSE, 0);
+      gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->forward, FALSE, FALSE, 0);
       gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->last, FALSE, FALSE, 0);
+      gtk_box_pack_end (GTK_BOX (priv->action_area), assistant->apply, FALSE, FALSE, 0);
     }
 
   gtk_widget_set_parent (priv->action_area, GTK_WIDGET (assistant));